file(GLOB_RECURSE utils_srcs *.cpp)
file(GLOB_RECURSE utils_srcs_cuda *.cu)
add_library(solar_utils STATIC ${utils_srcs})
add_library(solar_utils_cuda STATIC ${utils_srcs_cuda})
target_include_directories(solar_utils PUBLIC "${CMAKE_SOURCE_DIR}/source")
target_include_directories(solar_utils PUBLIC ${Boost_INCLUDE_DIRS})
target_include_directories(solar_utils_cuda PUBLIC "${CMAKE_SOURCE_DIR}/source")
target_include_directories(solar_utils_cuda PUBLIC ${Boost_INCLUDE_DIRS})
target_link_directories(solar_utils PUBLIC ${Boost_LIBRARY_DIR})
target_link_libraries(solar_utils PUBLIC gcem)
target_link_directories(solar_utils_cuda PUBLIC ${Boost_LIBRARY_DIR})
target_link_libraries(solar_utils_cuda PUBLIC gcem)

if(HAVE_STD_FORMAT)
    target_compile_definitions(solar_utils PUBLIC "HAVE_STD_FORMAT")
    target_compile_options(solar_utils PUBLIC "${STD_FORMAT_EXTRA_FLAGS}")
    if (CUDA20_SUPPORTED)
        target_compile_definitions(solar_utils_cuda PUBLIC "HAVE_STD_FORMAT")
        target_compile_options(solar_utils_cuda PUBLIC "${STD_FORMAT_EXTRA_FLAGS}")
    endif()
else()
    find_package(fmt REQUIRED)
    target_link_libraries(solar_utils PUBLIC fmt::fmt)
    target_link_libraries(solar_utils_cuda PUBLIC fmt::fmt)
endif()

if(HAVE_STD_PRINT)
    target_compile_definitions(solar_utils PUBLIC "HAVE_STD_PRINT")
    target_compile_options(solar_utils PUBLIC "${STD_FORMAT_EXTRA_FLAGS}")
    if (CUDA23_SUPPORTED)
        target_compile_definitions(solar_utils_cuda PUBLIC "HAVE_STD_PRINT")
        target_compile_options(solar_utils_cuda PUBLIC "${STD_FORMAT_EXTRA_FLAGS}")
    endif()
endif()

set_property(TARGET solar_utils_cuda PROPERTY CUDA_SEPARABLE_COMPILATION OFF)

if(SOLAR_WITH_QT)
    target_link_libraries(solar_utils
        PRIVATE Qt6::Quick
        PRIVATE Qt6::DataVisualization
        PRIVATE Qt6::Gui
    )
    target_compile_definitions(solar_utils PRIVATE "SOLAR_USE_QT")
endif()